/*******************************************************************************************
 *  Speed.c
 *
 *  Creating and managing Speed object structures.
 *
 *******************************************************************************************/







/*******************************************************************************************
 *  INCLUDES :
 *******************************************************************************************/

/* System and library related : */
#include <stdlib.h>
#include <string.h>

/* Project related : */
#include "Speed.h"







/*******************************************************************************************
 *  FUNCTIONS :
 *******************************************************************************************/

/*******************************************************************************************
 *  NEWSPEED : Creates an empty Speed object structure.
 *******************************************************************************************/
Speed *newSpeed(void) {
	Speed *s;

	/* Creating the container structure : */
	s = (Speed *)malloc(sizeof(Speed));


	/* Setting the object's type : */
	s->otype = speed;


	/* Returning the still empty structure : */
	return s;

}




/*******************************************************************************************
 *  FREESPEED : destroys a Speed object structure and all the objects it stores.
 *******************************************************************************************/
void freeSpeed(Speed *s) {

	free(s->value);			/* Free the value string.  */
	free(s);				/* Free the object itself. */

}




/*******************************************************************************************
 *  SETSPEEDTYPE : sets the Speed object's type of acceleration.
 *******************************************************************************************/
void setSpeedType(Speed *s, SpdType t) {
	s->type = t;
}



/*******************************************************************************************
 *  SETSPEEDVALUE : sets the Speed object's acceleration value.
 *******************************************************************************************/
void setSpeedValue(Speed *s, char *value) {
	s->value = value;
}
